package com.woniuxy.system.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.woniuxy.response.ResponseResult;
import com.woniuxy.system.demol.entity.ExportTable;
import com.woniuxy.system.demol.entity.SystemDepot;
import com.woniuxy.system.service.ExportTableService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author why
 * @since 2023-09-08
 */
@RestController
@RequestMapping("/export")
public class ExportTableController {
    @Resource
    private ExportTableService ExportTableService;
    @GetMapping("/findall/{currentPage}/{pageSize}")
    public ResponseResult<Page<ExportTable>> findall(@PathVariable("currentPage")Integer currentPage, @PathVariable("pageSize")Integer pageSize ){
        Page<ExportTable> page = new Page<>(currentPage, pageSize);
        Page<ExportTable> page1 = ExportTableService.page(page, null);
        return new ResponseResult<>(ResponseResult.SUCCESS,"success",page1);
    }
    //搜索所有
    @GetMapping("/searchAll/{input}/{currentPage}/{pageSize}")
    public ResponseResult<Page<ExportTable>> findStateClose( @PathVariable("input")String input, @PathVariable("currentPage")Integer currentPage, @PathVariable("pageSize")Integer pageSize ){
        QueryWrapper<ExportTable> wrapper = new QueryWrapper<>();
        wrapper.like("account", input).or().like("table_name", input);
        Page<ExportTable> page = new Page<>(currentPage, pageSize);
        Page<ExportTable> page2 = ExportTableService.page(page, wrapper);

        return new ResponseResult<>(ResponseResult.SUCCESS,"success",page2);
    }
}

